package com.docwei.thansgank.core;


import java.util.concurrent.TimeUnit;

import okhttp3.OkHttpClient;

/**
 * Created by tobo on 17/8/7.
 */

public class MainRetrofit {
    final Gson mGson = new GsonBuilder().setDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'").serializeNulls().create();
    private final Gank mService;

    public MainRetrofit() {
        OkHttpClient client = new OkHttpClient();
        client.setReadTimeout(21, TimeUnit.SECONDS);
        RestAdapter restAdapter=new RestAdapter.Builder()
                .setClient(new OkClient(client))
                .setEndpoint(MainFactory.HOST)
                .setConverter(new GsonConverter(mGson))
                .setLogLevel(RestAdapter.LogLevel.FULL)
                .build();
        mService = restAdapter.create(Gank.class);
    }
    public Gank getService(){
        return mService;
    }
}
